import 'package:flutter/material.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 满赠活动规则
///
class FullRule extends StatefulWidget {
  const FullRule({Key? key}) : super(key: key);

  @override
  State<FullRule> createState() => _FullRuleState();
}

class _FullRuleState extends State<FullRule> {
  double get leftWidth {
    return Sizes.default90;
  }

  double get rowHeight {
    return Sizes.default60;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar:
          ToolsUtils.getDefaultBrnAppBar('添加规则', actions: ToolsUtils.actions('确定', pressed: () {})),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(top: Sizes.default20),
              padding:
                  const EdgeInsets.symmetric(horizontal: Sizes.default15, vertical: Sizes.default8),
              decoration: const BoxDecoration(color: Colors.white),
              child: ListBody(
                children: [
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                            width: leftWidth,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                text: '赠送条件',
                                style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                              ),
                            ]))),
                        Expanded(
                            child: Container(
                          height: Sizes.default45,
                          padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                          margin: const EdgeInsets.only(right: Sizes.default15),
                          decoration: BoxDecoration(
                              color: ColorsUtils.rgba(247, 247, 247, 1),
                              borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                          child: TextField(
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color363, fontSize: Sizes.default15),
                            decoration: InputDecoration(
                                border: const OutlineInputBorder(
                                  borderSide: BorderSide.none,
                                ),
                                isCollapsed: true,
                                filled: true,
                                fillColor: Colors.transparent,
                                contentPadding: const EdgeInsets.symmetric(
                                    horizontal: Sizes.default10, vertical: Sizes.default10),
                                constraints: const BoxConstraints(minHeight: Sizes.default45),
                                hintText: '请输入满多少金额才送赠品',
                                hintStyle: StylesUtils.customTextStyle(
                                    fontSize: Sizes.default14, color: ColorsUtils.color999)),
                            keyboardType: TextInputType.number,
                            onChanged: (String content) {},
                          ),
                        )),
                      ],
                    ),
                  ),
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                            width: leftWidth,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                text: '赠品名称',
                                style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                              ),
                            ]))),
                        Expanded(
                            child: Container(
                          height: Sizes.default45,
                          padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                          margin: const EdgeInsets.only(right: Sizes.default15),
                          decoration: BoxDecoration(
                              color: ColorsUtils.rgba(247, 247, 247, 1),
                              borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                          child: TextField(
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color363, fontSize: Sizes.default15),
                            decoration: InputDecoration(
                                border: const OutlineInputBorder(
                                  borderSide: BorderSide.none,
                                ),
                                isCollapsed: true,
                                filled: true,
                                fillColor: Colors.transparent,
                                contentPadding: const EdgeInsets.symmetric(
                                    horizontal: Sizes.default10, vertical: Sizes.default10),
                                constraints: const BoxConstraints(minHeight: Sizes.default45),
                                hintText: '例如苹果',
                                hintStyle: StylesUtils.customTextStyle(
                                    fontSize: Sizes.default14, color: ColorsUtils.color999)),
                            keyboardType: TextInputType.text,
                            onChanged: (String content) {},
                          ),
                        )),
                      ],
                    ),
                  ),
                  Container(
                    height: rowHeight,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Container(
                            width: leftWidth,
                            alignment: Alignment.centerLeft,
                            child: Text.rich(TextSpan(children: [
                              TextSpan(
                                text: '赠品数量',
                                style: StylesUtils.customTextStyle(color: ColorsUtils.color333),
                              ),
                            ]))),
                        Expanded(
                            child: Container(
                          height: Sizes.default45,
                          padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                          margin: const EdgeInsets.only(right: Sizes.default15),
                          decoration: BoxDecoration(
                              color: ColorsUtils.rgba(247, 247, 247, 1),
                              borderRadius:
                                  const BorderRadius.all(Radius.circular(Sizes.default10))),
                          child: TextField(
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color363, fontSize: Sizes.default15),
                            decoration: InputDecoration(
                                border: const OutlineInputBorder(
                                  borderSide: BorderSide.none,
                                ),
                                isCollapsed: true,
                                filled: true,
                                fillColor: Colors.transparent,
                                contentPadding: const EdgeInsets.symmetric(
                                    horizontal: Sizes.default10, vertical: Sizes.default10),
                                constraints: const BoxConstraints(minHeight: Sizes.default45),
                                hintText: '请输入赠品数量',
                                hintStyle: StylesUtils.customTextStyle(
                                    fontSize: Sizes.default14, color: ColorsUtils.color999)),
                            keyboardType: TextInputType.number,
                            onChanged: (String content) {},
                          ),
                        )),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
